home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!hpl3sn03.cern.ch
- From: Dan Pop <danpop@mail.cern.ch>
- Newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.lang.eiffel
- Subject: Re: Hungarian notation
- Date: Tue, 23 Jan 1996 12:43:24 +0100
- Organization: CERN European Lab for Particle Physics
- Message-ID: <9601231143.AA21138@dxmint.cern.ch>
- References: <30C40F77.53B5@swsbbs.com> <4d2ok0$69s@beach.and.nl> <4dtv3gINNo9u@keats.ugrad.cs.ubc.ca> <SPENCER.96Jan22113215@zorgon.ERA.COM> <4e1nd8$hv0@solutions.solon.com>
- X-NNTP-Posting-Host: hpl3sn03.cern.ch
- X-Newsreader: NN version 6.5.0 #7 (NOV)
- X-Mail2News-Path: dxmint.cern.ch!hpl3sn03.cern.ch
-
- seebs@solutions.solon.com (Peter Seebach) writes:
-
- >In article <SPENCER.96Jan22113215@zorgon.ERA.COM>,
- >Spencer Allain <spencer@ERA.COM> wrote:
- >>It is incorrect to say that a 'char' (of size 1 byte on many systems)
- >>and an 'int' (of size 4 bytes on many systems) is structurally
- >>equivalent, yet I must be able to compile this without errors:
- >>(warnings are _not_ errors -- though I get none compiling this anyway)
- >
- >> char a;
- >> int b;
- >
- >> int main()
- >> {
- >> b = -154267 ;
- >> a = b ;
- >> return 0 ;
- >> }
- >
- >No warnings, perhaps, but undefined behavior unless CHAR_MIN is
- >less than or equal to -154267.
-
- Nope. The behaviour is implementation-defined. ANSI classic 3.2.1.2:
-
- When an integer is demoted to a signed integer with smaller size, or an
- unsigned integer is converted to its corresponding signed integer, if
- the value cannot be represented the result is implementation-defined.
-
- If char happens to be unsigned, the behaviour is well defined (but the
- "signedness" of char itself is implementation-defined :-)
-
- Dan
- --
- Dan Pop
- CERN, CN Division
- Email: danpop@mail.cern.ch
- Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
-